package system

import (
	"context"

	"go_admin/api/system/v1"
	"go_admin/internal/service"
)

func (c *ControllerV1) DictTypeList(ctx context.Context, req *v1.DictTypeListReq) (res *v1.DictTypeListRes, err error) {
	res, err = service.SysDictType().List(ctx, req)
	return
}
func (c *ControllerV1) DictTypeAdd(ctx context.Context, req *v1.DictTypeAddReq) (res *v1.DictTypeAddRes, err error) {
	err = service.SysDictType().Add(ctx, req, service.Context().GetUserId(ctx))
	return
}
func (c *ControllerV1) DictTypeGet(ctx context.Context, req *v1.DictTypeGetReq) (res *v1.DictTypeGetRes, err error) {
	res = new(v1.DictTypeGetRes)
	res.DictType, err = service.SysDictType().Get(ctx, req)
	return
}
func (c *ControllerV1) DictTypeEdit(ctx context.Context, req *v1.DictTypeEditReq) (res *v1.DictTypeEditRes, err error) {
	err = service.SysDictType().Edit(ctx, req, service.Context().GetUserId(ctx))
	return
}
func (c *ControllerV1) DictTypeDelete(ctx context.Context, req *v1.DictTypeDeleteReq) (res *v1.DictTypeDeleteRes, err error) {
	err = service.SysDictType().Delete(ctx, req.DictIds)
	return
}
func (c *ControllerV1) DictTypeAll(ctx context.Context, req *v1.DictTypeAllReq) (res *v1.DictTypeAllRes, err error) {
	res = new(v1.DictTypeAllRes)
	res.DictType, err = service.SysDictType().GetAllDictType(ctx)
	return
}
